<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>自定义随机数函数</title>
</head>

<body>
    <script>
        let getRandomNumber = function (M, N) {
            return Math.floor((Math.random() * (N - M + 1)) + M)
        }

        console.log(getRandomNumber(1,10));
    </script>
</body>

</html>